import Vue from 'vue'
import SvgIcon from '@/components/svg-icon'// svg component

// register globally
Vue.component('svg-icon', SvgIcon)

const req = require.context('./svg', false, /\.svg$/)
const requireAll = requireContext => requireContext.keys().map(requireContext)
requireAll(req)

const GetSvgIcon = () => {
    let list = [];
    req.keys().forEach(fileName => {
        const suffix = fileName.indexOf('.svg');
        const name = fileName.substring(2, suffix)
        list.push({
            name
        })
    });
    return list;
};

export default GetSvgIcon;
